/**
*      author: Y_Yao
*      created: 2024-12-14 20:09:35
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
int a,b,c,d,e;
int v[5];
vector<vector<int>> ret;

bool cmp(vector<int>& v1,vector<int>& v2)
{
    int sum1 = 0,sum2 = 0;
    for(auto e : v1) sum1 += e;
    for(auto e : v2) sum2 += e;
    return sum1 > sum2;
}


void solve()
{
    cin >> a >> b >> c >> d >> e;
    v[0] = a,v[1] = b,v[2] = c,v[3] = d,v[4] = e;
    unordered_map<int,char> hash;
    hash[a] = 'A';
    hash[b] = 'B';
    hash[c] = 'C';
    hash[d] = 'D';
    hash[e] = 'E';
    ret.push_back({a,b,c,d,e});
    ret.push_back({b,c,d,e});
    ret.push_back({a,c,d,e});
    ret.push_back({a,b,d,e});
    ret.push_back({a,b,c,e});
    ret.push_back({a,b,c,d});
    ret.push_back({c,d,e});
    ret.push_back({b,d,e});
    ret.push_back({a,d,e});
    ret.push_back({b,c,e});
    ret.push_back({a,c,e});
    ret.push_back({b,c,d});
    ret.push_back({a,b,e});
    ret.push_back({a,c,d});
    ret.push_back({a,b,d});
    ret.push_back({a,b,c});
    ret.push_back({d,e});
    ret.push_back({c,e});
    ret.push_back({b,e});
    ret.push_back({c,d});
    ret.push_back({a,e});
    ret.push_back({b,d});
    ret.push_back({a,d});
    ret.push_back({b,c});
    ret.push_back({a,c});
    ret.push_back({a,b});
    ret.push_back({a});
    ret.push_back({b});
    ret.push_back({c});
    ret.push_back({d});
    ret.push_back({e});

    sort(ret.begin(),ret.end(),cmp);

    for(int i = 0;i < ret.size();i++)
    {
        for(int j = 0;j < ret[i].size();j++)
        {
            cout << hash[ret[i][j]];
        }
        cout << endl;
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}